<script type="text/javascript">
	$(document).ready(function(){
		$('select[name=vitrixh]').change(function(){
			$(this).parent().submit();
		});
		$('select[name=phanloai]').change(function(){
			$(this).parent().submit();
		});
		
		$('.phanloai').change(function(){
			if($(this).val()==0){
				$('.vtxh').show();
			}else{
				$('.vtxh').hide();
			}
		});
		$("#textarea").htmlarea({
                toolbar: ["html", "|",
                        "forecolor",  // <-- Add the "forecolor" Toolbar Button
                        "|", "bold", "italic", "underline", "|", "p", "h1", "h2", "h3", "|", "link", "unlink"] // Overrides/Specifies the Toolbar buttons to show
		});
		$("#PostAddProject").validate({ 
	        rules: { 
              "tieude":"required",
              "noidung":"required",
              "diachi":"required",
              "loban":"required",
	        }, 
	        messages: { 
              "tieude": "Nhập tiêu đề bài viết",
              "noidung": "Nhập nội dung bài viết",
              "diachi": "Nhập địa chỉ",
              "loban": "Nhập lô bán",
	        } 
		});
	});	
</script>
<div id="content">
	
	<!-- Box -->
	<div class="box">
		<!-- Box Head -->
		<div class="box-head">
			<h2 class="left">Thông tin quản trị viên</h2>
			<!--<div class="right">
				<input type="text" class="field small-field" />
				<input type="submit" class="button" value="Tìm kiếm" />
			</div>-->
		</div>
		<!-- End Box Head -->	

		<!-- Table -->
		<div class="table">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<th width="13">STT</th>					
					<th width="10%"><?php echo $this->Paginator->sort('Tài khoản', 'username');?></th>
					<th width="30%"><?php echo $this->Paginator->sort('Mật khẩu','password');?></th>
					<th width="50" class="ac">Điều khiển</th>
				</tr>
				<?php
				$i = 0;
				$dem = 0;
				foreach ($users as $user):
					$class = null;
					if ($i++ % 2 == 0) {
						$class = ' class="altrow"';
					}
					$dem ++;
				?>
				<tr>
					<td><?php echo $dem;?></td>
					<td><h3><a href="#"><?php echo $user['User']['username']; ?></a></h3></td>
					<td><?php echo $user['User']['password']; ?></td>
					<td class="dieukhien"><?php echo $this->Html->link(__('Delete', true), array('action' => 'admin_delete', $user['User']['id']), null, sprintf(__('Bạn chắc chắn muốn xóa tài khoản này?', true), $user['User']['id'])); ?><?php echo $this->Html->link(__('Edit', true), array('action' => 'admin_edit', $user['User']['id'])); ?></td>
				</tr>
				<?php endforeach; ?>
				
			</table>
			
			
			<!-- Pagging -->
			<div class="paging">
				<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
			 | 	<?php echo $this->Paginator->numbers();?>
		 |
				<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
			</div>
			<!--<div class="pagging">
				<div class="left">Showing 1-12 of 44</div>
				<div class="right">
					<a href="#">Previous</a>
					<a href="#">1</a>
					<a href="#">2</a>
					<a href="#">3</a>
					<a href="#">4</a>
					<a href="#">245</a>
					<span>...</span>
					<a href="#">Next</a>
					<a href="#">View all</a>
				</div>
			</div>-->
			<!-- End Pagging -->
			
		</div>
		<!-- Table -->
		
	</div>
	<!-- End Box -->
	
	<!-- Box -->
	<div class="box">
		<!-- Box Head -->
		<div class="box-head">
			<h2>Thêm tài khoản</h2>
		</div>
		<!-- End Box Head -->
		
		<?php echo $this->Form->create('User', array('action' => 'admin_add'));?>
			
			<!-- Form -->
			<div class="form">
					<p>
						<?php echo $this->Form->input('username', array('label' => 'Tài khoản', 'class' => 'field size1')); ?>
					</p>
					<p>
						<?php echo $this->Form->input('password', array('label' => 'Mật khẩu', 'class' => 'field size1')); ?>
					</p>
											
			</div>
			<!-- End Form -->
			
			<!-- Form Buttons -->
			<div class="buttons">				
				<?php echo $this->Form->end(__('Submit', true));?>
			</div>
			<!-- End Form Buttons -->
		</form>
	</div>
	<!-- End Box -->

</div>